<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/><meta name="generator" content="Gatsby 2.20.27"/><title data-react-helmet="true"></title><style type="text/css">
    .anchor.before {
      position: absolute;
      top: 0;
      left: 0;
      transform: translateX(-100%);
      padding-right: 4px;
    }
    .anchor.after {
      display: inline-block;
      padding-left: 4px;
    }
    h1 .anchor svg,
    h2 .anchor svg,
    h3 .anchor svg,
    h4 .anchor svg,
    h5 .anchor svg,
    h6 .anchor svg {
      visibility: hidden;
    }
    h1:hover .anchor svg,
    h2:hover .anchor svg,
    h3:hover .anchor svg,
    h4:hover .anchor svg,
    h5:hover .anchor svg,
    h6:hover .anchor svg,
    h1 .anchor:focus svg,
    h2 .anchor:focus svg,
    h3 .anchor:focus svg,
    h4 .anchor:focus svg,
    h5 .anchor:focus svg,
    h6 .anchor:focus svg {
      visibility: visible;
    }
  </style><script>
    document.addEventListener("DOMContentLoaded", function(event) {
      var hash = window.decodeURI(location.hash.replace('#', ''))
      if (hash !== '') {
        var element = document.getElementById(hash)
        if (element) {
          var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
          var clientTop = document.documentElement.clientTop || document.body.clientTop || 0
          var offset = element.getBoundingClientRect().top + scrollTop - clientTop
          // Wait for the browser to finish rendering before scrolling.
          setTimeout((function() {
            window.scrollTo(0, offset - 0)
          }), 0)
        }
      }
    })
  </script><link rel="icon" href="/icons/icon-48x48.png?v=edf3d310d67f8284a562bc3a58c3e761"/><link rel="manifest" href="/manifest.webmanifest"/><meta name="theme-color" content="#663399"/><link rel="apple-touch-icon" sizes="48x48" href="/icons/icon-48x48.png?v=edf3d310d67f8284a562bc3a58c3e761"/><link rel="apple-touch-icon" sizes="72x72" href="/icons/icon-72x72.png?v=edf3d310d67f8284a562bc3a58c3e761"/><link rel="apple-touch-icon" sizes="96x96" href="/icons/icon-96x96.png?v=edf3d310d67f8284a562bc3a58c3e761"/><link rel="apple-touch-icon" sizes="144x144" href="/icons/icon-144x144.png?v=edf3d310d67f8284a562bc3a58c3e761"/><link rel="apple-touch-icon" sizes="192x192" href="/icons/icon-192x192.png?v=edf3d310d67f8284a562bc3a58c3e761"/><link rel="apple-touch-icon" sizes="256x256" href="/icons/icon-256x256.png?v=edf3d310d67f8284a562bc3a58c3e761"/><link rel="apple-touch-icon" sizes="384x384" href="/icons/icon-384x384.png?v=edf3d310d67f8284a562bc3a58c3e761"/><link rel="apple-touch-icon" sizes="512x512" href="/icons/icon-512x512.png?v=edf3d310d67f8284a562bc3a58c3e761"/><link as="script" rel="preload" href="/webpack-runtime-37f1cbc6cebaadfe94d8.js"/><link as="script" rel="preload" href="/framework-3321703c33570853116c.js"/><link as="script" rel="preload" href="/9e82d048-510a147398e950707384.js"/><link as="script" rel="preload" href="/app-d1c198c391345cb7546f.js"/><link as="script" rel="preload" href="/8e82a8285a059e40172b3fce3456b4d513f6f72a-578946d2e6fad0f3e98f.js"/><link as="script" rel="preload" href="/component---src-pages-docs-enjoy-mdx-5d76df1dde88425fc86e.js"/><link as="fetch" rel="preload" href="/page-data/docs/enjoy/page-data.json" crossorigin="anonymous"/><link as="fetch" rel="preload" href="/page-data/app-data.json" crossorigin="anonymous"/></head><body><div id="___gatsby"><style data-emotion-css="d6jcgn">html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0;}main{display:block;}h1{font-size:2em;margin:0.67em 0;}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace,monospace;font-size:1em;}a{background-color:transparent;}abbr[title]{border-bottom:none;-webkit-text-decoration:underline;text-decoration:underline;-webkit-text-decoration:underline dotted;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;}b,strong{font-weight:bolder;}code,kbd,samp{font-family:monospace,monospace;font-size:1em;}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sub{bottom:-0.25em;}sup{top:-0.5em;}img{border-style:none;}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible;}button,select{text-transform:none;}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0;}fieldset{padding:0.35em 0.75em 0.625em;}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline;}textarea{overflow:auto;}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0;}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{-webkit-appearance:none !important;}input[type="number"]{-moz-appearance:textfield;}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px;}[type="search"]::-webkit-search-decoration{-webkit-appearance:none !important;}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block;}summary{display:list-item;}template{display:none;}[hidden]{display:none !important;}html{box-sizing:border-box;font-family:sans-serif;}*,*::before,*::after{box-sizing:border-box;}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0;}button{background:transparent;padding:0;}fieldset{margin:0;padding:0;}ol,ul{margin:0;padding:0;}html{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";line-height:1.5;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;text-rendering:optimizelegibility;}hr{border-top-width:1px;}img{border-style:solid;}textarea{resize:vertical;}button,[role="button"]{cursor:pointer;}button::-moz-focus-inner{border:0 !important;}table{border-collapse:collapse;}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit;}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit;}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit;}pre,code,kbd,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle;}img,video{max-width:100%;height:auto;}html{line-height:1.5;color:#1A202C;}*,*::before,*::after{border-width:0;border-style:solid;border-color:#E2E8F0;}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#A0AEC0;}input::-ms-input-placeholder,textarea::-ms-input-placeholder{color:#A0AEC0;}input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#A0AEC0;}input::-moz-placeholder,textarea::-moz-placeholder{color:#A0AEC0;}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#A0AEC0;}input::placeholder,textarea::placeholder{color:#A0AEC0;}</style><div style="outline:none" tabindex="-1" id="gatsby-focus-wrapper"><style data-emotion-css="d6jcgn">html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0;}main{display:block;}h1{font-size:2em;margin:0.67em 0;}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace,monospace;font-size:1em;}a{background-color:transparent;}abbr[title]{border-bottom:none;-webkit-text-decoration:underline;text-decoration:underline;-webkit-text-decoration:underline dotted;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;}b,strong{font-weight:bolder;}code,kbd,samp{font-family:monospace,monospace;font-size:1em;}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sub{bottom:-0.25em;}sup{top:-0.5em;}img{border-style:none;}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible;}button,select{text-transform:none;}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0;}fieldset{padding:0.35em 0.75em 0.625em;}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline;}textarea{overflow:auto;}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0;}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{-webkit-appearance:none !important;}input[type="number"]{-moz-appearance:textfield;}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px;}[type="search"]::-webkit-search-decoration{-webkit-appearance:none !important;}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block;}summary{display:list-item;}template{display:none;}[hidden]{display:none !important;}html{box-sizing:border-box;font-family:sans-serif;}*,*::before,*::after{box-sizing:border-box;}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0;}button{background:transparent;padding:0;}fieldset{margin:0;padding:0;}ol,ul{margin:0;padding:0;}html{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";line-height:1.5;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;text-rendering:optimizelegibility;}hr{border-top-width:1px;}img{border-style:solid;}textarea{resize:vertical;}button,[role="button"]{cursor:pointer;}button::-moz-focus-inner{border:0 !important;}table{border-collapse:collapse;}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit;}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit;}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit;}pre,code,kbd,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle;}img,video{max-width:100%;height:auto;}html{line-height:1.5;color:#1A202C;}*,*::before,*::after{border-width:0;border-style:solid;border-color:#E2E8F0;}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#A0AEC0;}input::-ms-input-placeholder,textarea::-ms-input-placeholder{color:#A0AEC0;}input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#A0AEC0;}input::-moz-placeholder,textarea::-moz-placeholder{color:#A0AEC0;}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#A0AEC0;}input::placeholder,textarea::placeholder{color:#A0AEC0;}</style><style data-emotion-css="1ljyg5i">.js-focus-visible :focus:not([data-focus-visible-added]){outline:none;box-shadow:none;}html{-webkit-scroll-behavior:smooth;-moz-scroll-behavior:smooth;-ms-scroll-behavior:smooth;scroll-behavior:smooth;}@media screen and (prefers-reduced-motion:reduce){html{-webkit-scroll-behavior:auto;-moz-scroll-behavior:auto;-ms-scroll-behavior:auto;scroll-behavior:auto;}}body{overflow:hidden;padding:0;}.container{height:90vh;width:100vw;display:grid;grid-template-columns:1fr;grid-template-rows:1fr;}.body{display:grid;grid-template-columns:.75fr 3fr;overflow:hidden;margin-top:1rem;}@media (max-width:767px){.body{grid-template-columns:1fr;}}.body p{padding-bottom:1.25rem;}.sidebar li{margin-bottom:.5rem;font-size:1rem;font-weight:bold;cursor:pointer;}.sidenav{list-style-type:none;}@media (min-width:360px){.sidebar{display:none;}}.footer{border-top:1px solid lightgrey;}.content{margin-top:.4rem;overflow-y:scroll;}pre{padding-top:.5rem;padding-left:.5rem;margin-bottom:1rem;border-radius:8px;overflow:auto;}@media (min-width:360px){pre{font-size:.8rem;}}@media (min-width:500px){pre{font-size:.9rem;color:#569CD6;background-color:#0E0E0E;padding:4px;border-radius:3px;}}@media (min-width:768px){pre{font-size:1rem;color:#569CD6;background-color:#0E0E0E;padding:4px;border-radius:3px;}}@media (min-width:360px){code{font-size:.9rem;color:#569CD6;background-color:#0E0E0E;padding:4px;border-radius:3px;}}@media (min-width:768px){code{font-size:1rem;color:#569CD6;background-color:#0E0E0E;padding:4px;border-radius:3px;}}@media (min-width:1024px){code{font-size:1.1rem;color:#569CD6;background-color:#0E0E0E;padding:4px;border-radius:3px;}}</style><style data-emotion-css="yas2jg">.css-yas2jg{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:.6rem;background-color:grey.600;color:#000;}</style><nav class="css-yas2jg"><style data-emotion-css="70qvj9">.css-70qvj9{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}</style><div class="css-70qvj9"><style data-emotion-css="u9p4xe">.css-u9p4xe{cursor:pointer;padding-bottom:2px;}</style><style data-emotion-css="z78c3l">.css-z78c3l{margin-left:0.25rem;margin-right:0.75rem;margin-top:0.25rem;cursor:pointer;padding-bottom:2px;}@media screen and (min-width:30em){.css-z78c3l{display:block;}}@media screen and (min-width:48em){.css-z78c3l{display:none;}}</style><div class="css-z78c3l"><svg fill="black" width="17px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><title>Menu</title><path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"></path></svg></div><style data-emotion-css="1llngja">.css-1llngja{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-left:0.25rem;}</style><div class="css-1llngja"><a href="/"><style data-emotion-css="8ami09">.css-8ami09{font-size:1.875rem;line-height:1.25;font-weight:700;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";color:pri;}@media screen and (min-width:48em){.css-8ami09{font-size:2.25rem;}}</style><h1 style="letter-spacing:-3px" class="css-8ami09">useAuth</h1></a></div></div><style data-emotion-css="1vcx8sl">.css-1vcx8sl{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:none;}@media screen and (min-width:30em){.css-1vcx8sl{display:none;width:100%;}}@media screen and (min-width:48em){.css-1vcx8sl{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:auto;}}</style><div class="css-1vcx8sl"><style data-emotion-css="1ey9b7m">.css-1ey9b7m{color:sec;display:block;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";margin-right:1rem;margin-top:1rem;}@media screen and (min-width:48em){.css-1ey9b7m{margin-top:0;}}</style><p class="css-1ey9b7m"><a href="https://github.com/Swizec/useAuth">GitHub  </a></p><style data-emotion-css="c4fa1y">.css-c4fa1y{border-radius:0.25rem;font-weight:600;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:all 250ms;transition:all 250ms;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;white-space:nowrap;vertical-align:middle;line-height:1.2;outline:none;height:2.5rem;min-width:2.5rem;font-size:1rem;padding-left:1rem;padding-right:1rem;background-color:#EDF2F7;}.css-c4fa1y:hover{background-color:#E2E8F0;}.css-c4fa1y:focus{box-shadow:0 0 0 3px rgba(66,153,225,0.6);}.css-c4fa1y:active,.css-c4fa1y[data-active=true]{background-color:#CBD5E0;}.css-c4fa1y:disabled,.css-c4fa1y:disabled:focus,.css-c4fa1y:disabled:hover,.css-c4fa1y[aria-disabled=true],.css-c4fa1y[aria-disabled=true]:focus,.css-c4fa1y[aria-disabled=true]:hover{opacity:0.4;cursor:not-allowed;box-shadow:none;}</style><button type="button" class="css-c4fa1y">Login</button><style data-emotion-css="1vu52aw">.css-1vu52aw{display:none;margin-top:1rem;}@media screen and (min-width:30em){.css-1vu52aw{display:none;}}@media screen and (min-width:48em){.css-1vu52aw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-top:0;}}</style><div class="css-1vu52aw"><style data-emotion-css="192sbdz">.css-192sbdz{border-radius:9999px;font-weight:600;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:all 250ms;transition:all 250ms;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;white-space:nowrap;vertical-align:middle;line-height:1.2;outline:none;height:2.5rem;min-width:2.5rem;font-size:20px;padding-left:1rem;padding-right:1rem;color:currentColor;padding:0;margin-left:1.735rem;}.css-192sbdz:hover{background-color:#EDF2F7;}.css-192sbdz:focus{box-shadow:0 0 0 3px rgba(66,153,225,0.6);}.css-192sbdz:active,.css-192sbdz[data-active=true]{background-color:#E2E8F0;}.css-192sbdz:disabled,.css-192sbdz:disabled:focus,.css-192sbdz:disabled:hover,.css-192sbdz[aria-disabled=true],.css-192sbdz[aria-disabled=true]:focus,.css-192sbdz[aria-disabled=true]:hover{opacity:0.4;cursor:not-allowed;box-shadow:none;}</style><button type="button" aria-label="Switch to dark mode" class="css-192sbdz"><style data-emotion-css="1im46kq">.css-1im46kq{width:1em;height:1em;color:currentColor;display:inline-block;vertical-align:middle;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-backface-visibility:hidden;backface-visibility:hidden;}.css-1im46kq:not(:root){overflow:hidden;}</style><svg viewBox="0 0 24 24" focusable="false" role="presentation" aria-hidden="true" class="css-1im46kq"><g stroke-linejoin="full" stroke-linecap="full" stroke-width="2" fill="none" stroke="currentColor"><circle cx="12" cy="12" r="5"></circle><path d="M12 1v2"></path><path d="M12 21v2"></path><path d="M4.22 4.22l1.42 1.42"></path><path d="M18.36 18.36l1.42 1.42"></path><path d="M1 12h2"></path><path d="M21 12h2"></path><path d="M4.22 19.78l1.42-1.42"></path><path d="M18.36 5.64l1.42-1.42"></path></g></svg></button></div></div></nav><div class="container css-0"><div class="body css-0"><style data-emotion-css="14sc4sh">.css-14sc4sh{margin-left:1rem;}@media screen and (min-width:30em){.css-14sc4sh{display:none;}}@media screen and (min-width:48em){.css-14sc4sh{display:block;}}</style><div class="sidebar css-14sc4sh"><ul class="sidenav"><li></li><li><a href="/./docs/getting-started/">Getting Started</a></li><li><a href="/./docs/auth/">Auth Provider</a></li><li><a href="/./docs/callback">Callback page</a></li><li><a href="/./docs/enjoy">Enjoy</a></li></ul></div><style data-emotion-css="1xnh5kf">.css-1xnh5kf{display:block;font-size:0.875rem;max-width:40rem;padding-left:2rem;padding-right:1rem;}@media screen and (min-width:30em){.css-1xnh5kf{font-size:1rem;width:100%;}}@media screen and (min-width:48em){.css-1xnh5kf{font-size:1.125rem;}}@media screen and (min-width:62em){.css-1xnh5kf{font-size:1.25rem;}}</style><div class="content css-1xnh5kf"><style data-emotion-css="k9oqgk">.css-k9oqgk{font-size:1.25rem;line-height:1.25;font-weight:700;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";margin-bottom:1rem;}</style><h2 id="4-enjoy-useauth" style="position:relative" class="css-k9oqgk"><a href="#4-enjoy-useauth" aria-label="4 enjoy useauth permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>4. Enjoy useAuth</h2><p>You&#x27;re ready to use useAuth for authentication in your React app.</p><p>Here&#x27;s a login button for example:</p><pre><code class="language-jsx">const Login = () =&gt; {
    const { isAuthenticated, login, logout } = useAuth()

    if (isAuthenticated()) {
        return &lt;Button onClick={logout}&gt;Logout&lt;/Button&gt;
    } else {
        return &lt;Button onClick={login}&gt;Login&lt;/Button&gt;
    }
}
</code></pre><p><code>isAuthenticated</code> is a method that checks if the user&#x27;s cookie is still valid.</p><p><code>login</code> and <code>logout</code> trigger their respective actions.</p><p>You can even say hello to your users:</p><pre><code class="language-jsx">// src/pages/index.js

const IndexPage = () =&gt; {
  const { isAuthenticated, user } = useAuth()

  return (
    &lt;Layout&gt;
      &lt;SEO title=&quot;Home&quot; /&gt;
      &lt;h1&gt;Hi {isAuthenticated() ? user.name : &quot;people&quot;}&lt;/h1&gt;
  )
}
</code></pre><p>Check <code>isAuthenticated</code> then use the user object. Simple as that.</p></div></div></div></div><div id="gatsby-announcer" style="position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0" aria-live="assertive" aria-atomic="true"></div></div><script id="gatsby-script-loader">/*<![CDATA[*/window.pagePath="/docs/enjoy/";/*]]>*/</script><script id="gatsby-chunk-mapping">/*<![CDATA[*/window.___chunkMapping={"app":["/app-d1c198c391345cb7546f.js"],"component---src-pages-404-js":["/component---src-pages-404-js-670d78c077072ad10c98.js"],"component---src-pages-auth-0-callback-js":["/component---src-pages-auth-0-callback-js-43c5d91e91b0ce57c4a5.js"],"component---src-pages-docs-auth-mdx":["/component---src-pages-docs-auth-mdx-8a523fea82b58e688a94.js"],"component---src-pages-docs-callback-mdx":["/component---src-pages-docs-callback-mdx-12c8e7ed8599ad0f8a79.js"],"component---src-pages-docs-enjoy-mdx":["/component---src-pages-docs-enjoy-mdx-5d76df1dde88425fc86e.js"],"component---src-pages-docs-getting-started-mdx":["/component---src-pages-docs-getting-started-mdx-9d1444ad087d61d15115.js"],"component---src-pages-index-js":["/component---src-pages-index-js-4a86f52f350c1cc5ec08.js"]};/*]]>*/</script><script src="/component---src-pages-docs-enjoy-mdx-5d76df1dde88425fc86e.js" async=""></script><script src="/8e82a8285a059e40172b3fce3456b4d513f6f72a-578946d2e6fad0f3e98f.js" async=""></script><script src="/app-d1c198c391345cb7546f.js" async=""></script><script src="/9e82d048-510a147398e950707384.js" async=""></script><script src="/framework-3321703c33570853116c.js" async=""></script><script src="/webpack-runtime-37f1cbc6cebaadfe94d8.js" async=""></script></body></html>